import { Fragment, defineComponent, reactive } from 'vue';
import { layersContainer, many, one } from './Layers.module.scss';
import { map } from '@/store';
/*
---文件
*/
export const layersObj = reactive({
    isShow: true,
})

export default defineComponent({
    name: 'Layers',
    data() {
        return {
            floorMany: false,
        };
    },
    methods: {
        setVisibleLevels() {
            if (this.floorMany) {
                map.fmap.setVisibleLevels([map.activeFloor]);
            } else {
                let levels = [] as any[];
                map.floorInfos.forEach(item => {
                    levels.push(item.level)
                })
                map.fmap.setVisibleLevels(levels);
            }
            this.floorMany = !this.floorMany;
        }
    },
    render() {
        return <Fragment>
            <div class={layersContainer} v-if={layersObj.isShow} onClick={this.setVisibleLevels}>
                {this.floorMany ? <div class={one}></div> : <div class={many}></div>}
            </div>
        </Fragment>;
    },
});